<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>管理员登录</title>
    <script src="$!webPath/js/jquery.min.js"></script>
    <style>
        html,body{
            margin: 0;
            padding: 0;
            width: 100%;
            height: 100%;
            overflow:hidden;
        }
        .div_login:before{
            content:"";
            display:inline-block;
            height:100%;
            width:0;
            vertical-align: middle;
            margin-left:-.25em;
        }
        .div_title{
            text-align: center;
            font-size: 56px;
            background-color: lightgray;
            height: 80px;
            line-height: 80px;
        }
        .input_login{
            width: 60%;
            height: 50px;
            line-height: 50px;
            border: 1px solid #ccc;
            border-radius: 4px;
            font-size: 36px;
        }
        .content{
            font-size: 36px;
            padding: 10px 20px;
            text-align: center;
            background-color: #eee;
        }
        .lab_mar{
            display: block;
            margin-top: 30px;
        }
        .btn_login{
            width: 30%;
            height: 50px;
            line-height: 50px;
            margin-top: 40px;
            border: 1px solid #ccc;
            border-radius: 4px;
            font-size: 36px;
        }
        .input_w{
            width: 48%;
        }
    </style>
</head>
<body>
<div class="div_login">
    <div class="div_title">管理员登录</div>
    <div class="content">
        <form  method="post">
            <label class="lab_mar">
                用户名：<input type="text" id="userName" class="input_login"/>
            </label>
            <label class="lab_mar">
                密&nbsp;&nbsp;&nbsp;码：<input type="password" id="userPwd" class="input_login"/>
            </label>
            <label class="lab_mar">
                验证码：<input type="text" id="code" class="input_login input_w"/>
                <img height="50px;" id="img" src="$!webPath/verifyPic?w=70&h=34" onclick=" this.src='$!webPath/verifyPic?w=70&h=34'+'&'+Math.random()" style="position:relative;top: 12px;right:0px;">
            </label>
            <input type="button" class="btn_login" value="登录" id="btn_login"/>
            <a href="#" style="text-align:center;font-size:30px;margin-left:10px;">注册</a>
        </form>
    </div>
</div>
<script>
     $('#btn_login').click(function(){
         var userName=$('#userName').val();
         var userPwd=$('#userPwd').val();
         var code=$('#code').val();
         if(userName==''||userPwd==''||code==''){
             alert('用户名和密码不能为空');
         }
         $.ajax({
             type: "POST",
             url: "$!webPath/login",
             data: {"userName": userName,"password":userPwd,"verifyCode":code},
             success: function (data) {
                 if(data.data == "success") {
                     window.location.href = "$!webPath/admin/introduction/introduction_list?size=10&page=0";
                 }
                 else{
                     $("#error").text(data.data);
                     $("#img").attr("src","$!webPath/verifyPic?w=70&h=34"+"&"+Math.random());
                 }
             }
         })
     })
</script>
</body>
</html>